import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { PrismaModule } from './prisma/prisma.module';
import { AuthModule } from './auth/auth.module';
import { UserModule } from './user/user.module';
import { JwtModule } from '@nestjs/jwt';
import { APP_GUARD } from '@nestjs/core';
import { AuthGuard } from './gu/auth/auth.guard';
import { FriendsShipModule } from './friends-ship/friends-ship.module';
import { ChatRoomModule } from './chat-room/chat-room.module';
import { ChatsModule } from './chats/chats.module';
import { MessageModule } from './message/message.module';
import { FileModule } from './file/file.module';
import { CollectModule } from './collect/collect.module';

@Module({
  imports: [
    PrismaModule,
    AuthModule,
    UserModule,
    JwtModule.register({
      secret: 'secret',
      signOptions: { expiresIn: '7d' },
      global: true,
    }),
    FriendsShipModule,
    ChatRoomModule,
    ChatsModule,
    MessageModule,
    FileModule,
    CollectModule,
  ],
  controllers: [AppController],
  providers: [
    AppService,
    {
      provide: APP_GUARD,
      useClass: AuthGuard,
    },
  ],
})
export class AppModule {}
